package com.bnz.dao;

import com.bnz.pojo.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


public interface StudentDao extends JpaRepository<Student,Integer>, JpaSpecificationExecutor<Student> {

    List<Student> findBySnameLikeAndAddrLike(String sname,String addr);

    @Query(value="select st.*,cname from student st,classes c where c.cid=st.cid",nativeQuery=true)
    List<Student> findStudents();

    //添加语句
    /*@Query(value="insert into student values (null,?1,?2,?3,?4,?5)",nativeQuery=true)
    @Modifying
    void savess(Student student);*/

}